﻿using MVCBootStrapShell_WithTheme.Filters;
using MVCBootStrapShell_WithTheme.Models;
using MVCBootStrapShell_WithTheme.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MVCBootStrapShell_WithTheme.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            var movies = new List<Movie>
            {
                new Movie{Title = "The Last Starfighter", Rating = 4},
                new Movie{Title = "Flight of the Navigator", Rating = 3},
                new Movie{Title = "Raiders of the Lost Ark",  Rating = 4},
                new Movie{Title = "Amelie",  Rating = 5}
            };

            return View(movies);

            //var movie = new Movie
            //{
            //    Title = "The Last Starfighter",
            //    Rating = 4
            //};
            //return View(movie);

            //var context = new SiteDataContext();

            //var notifications = context.Notifications
            //    .GroupBy(n => n.NotificationType)
            //    .Select(g => new NotificationViewModel
            //    {
            //        Count = g.Count(),
            //        NotificationType = g.Key.ToString(),
            //        BadgeClass = NotificationType.Email == g.Key
            //            ? "success"
            //            : "info"
            //    });

            //ViewBag.Notifications = notifications;

            //return View();
        }

        [HttpPost]
        public ActionResult Index(Movie movie)
        {
            return View("Index", movie);
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }
    }
}